package com.example.intelligentattendancesystem.Utils;

import com.example.intelligentattendancesystem.mapping.UserMapping;
import com.example.intelligentattendancesystem.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * @author
 * @version 1.0
 * @className UserUtile
 * @since 1.0
 */
@Component
public class UserTool{
    @Autowired
    UserMapping userMapping;
    public List<User> getUsersByUserIds(List<Integer> ids){
        List<User> users = userMapping.selectAllUser();
        List<User> users1 = new ArrayList<>();
        for (Integer id : ids) {
            for (User user : users) {
                if(user.getUserId()==id){
                    users1.add(user);
                    break;
                }
            }
        }
        return users1;
    }
}
